package com.cardbaobao.cardbabyclient.ui.fragment.base;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * MyFragmentPagerAdapter
 * Created by zad
 * 2016/8/1 9:30
 */

public class MyFragmentPagerAdapter extends FragmentPagerAdapter {

    private List<? extends BaseFragment> mFragments;

    private int count;

    public MyFragmentPagerAdapter(FragmentManager fm, List<? extends BaseFragment> mFragments) {
        super(fm);
        this.mFragments = mFragments;
        count = mFragments.size();
    }

    public void setDataSource(List<? extends BaseFragment> mFragments){
        this.mFragments = mFragments;
        count = mFragments.size();
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return count;
    }
}
